<?
	$params[sid] = $sid;
	$params[action] = "changeBankDetails";
	$url = "$baseURL/$webDIR/?".encode_params($params);

	$info2 = list_bank_details($id,'array');
	$info2 = $info2[0];
	$info = array_merge($info1,$info2);

	//	nd4wd patch select the bank details from rp2

	$query = "SELECT swift_code,bank_name,bank_address,account_number,routing_number,account_holder,payment_method,paypal_email,release_level as current_release_level FROM resellers WHERE reseller_id='$id'";
	$GLOBALS[master_db]->query($query);
	$info = $GLOBALS[master_db]->getNext();

	//	nd4wd patch select the bank details from rp2

	$signup_date=get_signup_date($id);
	$show_flag=0;
	if( (date('d')<29 && date('d')>6 ) || $signup_date>date('Y-m-d',time()-3600*24*30)) $show_flag=1;
?>
<script language='Javascript'>

function show_hide_div(el){
	var sv = el.value;
	document.getElementById('div_wire').style.display='none';
	document.getElementById('div_paypal').style.display='none';
//	if (sv != "wallet") document.getElementById('div_crl').style.display='block';
//	else document.getElementById('div_crl').style.display='none';
	if (document.getElementById('div_'+el.value)) document.getElementById('div_'+el.value).style.display='block';
}

</script>

<table width="550">
  <tr>
    <td colspan=2><font class="text"><b><?=translate('change_details_');?><br>
      <br>
      </b>
      <?=translate('change_details_desc');?>
      </font></td>
  </tr>
</table><br>
<?=translate('important');?>
<br><br>
<?
	if ($errorMsg) {
	include_once('errorMsg.html');
	}
	if ($okMsg) {
	include_once('okMsg.html');
	}
	else{
	}
?>
<TABLE border=1 class='bTable' cellspacing='0' width="550">
  <form action='<?=$url;?>' method='POST'>
	<tr>
		<th colspan='2'>
			<?=translate('bank_info');?>
		</th>
	</tr>
	<tr <? if($errorCode==18) echo "class='err'"; ?>><td width='150'><?=translate('payment_method');?></td>
		<td>
			<select name='payment_method' onChange='show_hide_div(this)' <?if(!$show_flag) echo "disabled"?>>
			<?
				$opt = "
				<option value='wire'>" . translate('bank_wire') . "</option>
				<option value='check'>" . translate('check'). "</option>
				<option value='paypal'>" . translate('paypal') . "</option>
				<option value='wallet'>" . translate('wallet') . "</option>
				";
				$newopt = str_replace("'$info[payment_method]'","$info[payment_method] selected",$opt);
				echo $newopt;
			?>
			</select>
        <?=translate('if_check_selected');?>.
      </td>
	</tr></table>
<!--<div id='div_crl' <?if($info[payment_method]=='wallet') echo 'style="display:none"'?>-->
<br>
<TABLE border=1 class='bTable' cellspacing='0' width="550">
	<tr <? if($errorCode==19) echo "class='err'"; ?>><td width='150'><?=translate('cur_levels');?></td>
                <td>
                        <select name='current_release_level'  <?if(!$show_flag) echo "disabled"?>>
                        <?
                                if(!$info[current_release_level]) $info[current_release_level] = 200;
                                $opt = "
                                          <option value='50'>$50</option>
                                          <option value='100'>$100</option>
                                          <option value='200'>$200</option>
                                          <option value='300'>$300</option>
                                          <option value='400'>$400</option>
                                          <option value='500'>$500</option>
                                          <option value='1000'>$1000</option>
                                          <option value='1500'>$1500</option>
                                          <option value='2000'>$2000</option>
                                          <option value='2500'>$2500</option>
                                          <option value='3000'>$3000</option>
                                          <option value='5000'>$5000</option>";
                                $newopt = str_replace("'".sprintf("%01u",$info[current_release_level])."'","'".sprintf("%01u",$info[current_release_level])."' selected",$opt);
                                echo $newopt;
                        ?>
                        </select>
                        <?=translate('min_release_level');?>.
                </td>
        </tr>
</TABLE>
<!--</div>-->
<div id='div_wire' <?if($info[payment_method]!='wire') echo 'style="display:none"'?>>
<br>
<TABLE border=1 class='bTable' cellspacing='0' width="550">
	<tr <? if($errorCode==12) echo "class='err'"; ?>><td width='150'><?=translate('swift');?></td>
		<td>
			<input type='text' name='swift_code' value='<?=$info[swift_code];?>'>
		</td>
	</tr>
	<tr <? if($errorCode==13) echo "class='err'"; ?>><td width='150'><?=translate('bank_name');?></td>
		<td>
			<input type='text' name='bank_name' value='<?=$info[bank_name];?>'>
		</td>
	</tr>
	<tr <? if($errorCode==14) echo "class='err'"; ?>><td width='150'><?=translate('bank_address');?></td>
		<td>
			<input type='text' name='bank_address' value='<?=$info[bank_address];?>'>
		</td>
	</tr>
	<tr <? if($errorCode==15) echo "class='err'"; ?>><td width='150'><?=translate('acc_number');?></td>
		<td>
			<input type='text' name='account_number' value='<?=$info[account_number];?>'>
		</td>
	</tr>
	<tr <? if($errorCode==16) echo "class='err'"; ?>><td width='150'><?=translate('routing_num');?></td>
		<td>
			<input type='text' name='routing_number' value='<?=$info[routing_number];?>'>
		</td>
	</tr>
	<tr <? if($errorCode==17) echo "class='err'"; ?>><td width='150'><?=translate('acc_holder');?></td>
		<td>
			<input type='text' name='account_holder' value='<?=$info[account_holder];?>'>
		</td>
	</tr></table>
</div>
<div id='div_paypal' <?if($info[payment_method]!='paypal') echo 'style="display:none"'?>>
<br>
<TABLE border=1 class='bTable' cellspacing='0' width="550">
	<tr <? if($errorCode==18) echo "class='err'"; ?>><td width='150'><?=translate('paypal_email');?></td>
		<td>
			<input type='text' name='paypal_email' value='<?=$info[paypal_email];?>'>
		</td>
	</tr></table>
</div>

<br>
<TABLE border=1 class='bTable' cellspacing='0' width="550">
	<tr><td colspan='2' align='center'>
		<input type='button' value='<?=translate('back');?>' onClick='javascript:history.go(-1)'>
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type='submit' value='<?=translate('change');?>'>
	</td></tr>
	</form>
</TABLE>
